Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 612 Bytes

3.5.1 - Coroutine/Http2/Client->__construct.md

File metadata and controls

13 lines (10 loc) · 612 Bytes

Coroutine\Http2\Client->__construct

构造方法,函数原型:

function Coroutine\Http2\Client->__construct(string $host, int $port, bool $ssl = false);
  • $host 目标主机的IP地址,$host如果为域名底层需要进行一次DNS查询
  • $port 目标端口,Http一般为80端口,Https一般为443端口
  • $ssl 是否开启TLS/SSL隧道加密,https网站必须设置为true
  • 默认超时时间为500ms,如果你需要请求外网URL请修改timeout为更大的数值

$ssl需要依赖openssl,必须在编译swoole时启用--enable-openssl